{# Reusable Jinja2 macros. Import what you need at the top of a template: {% from "components/macros.html" import primary_button, or_divider %} Macros that take a body are called with {% call %}: {% call info_tooltip() %}

Explanation.

{% endcall %} #} {# -- Overlays -------------------------------------------------------------- #} {# Full-bleed dismiss layer behind a modal. Pair it with the modal panel:
{{ modal_scrim("close()") }}
...
#} {% macro modal_scrim(dismiss_handler="open = false") %}
{% endmacro %} {# THE tooltip panel — the one popover shell every hover/help hint uses. Callers provide the open/show()/hide() Alpine state on a ``relative`` wrapper and pass the body via {% call %}. Change tooltip styling here, nowhere else. #} {% macro popover_panel(align='left') %} {% endmacro %} {# Inline definition hint — wrap a term via {% call %}; hovering (or tapping) opens the shared popover panel. Dotted underline signals the affordance without a "?" button. ``align='right'`` for terms near the right edge. #} {% macro hover_hint(title, text, align='left') %} {{ caller() }} {% call popover_panel(align) %}
{{ title }}
{{ text }}
{% endcall %}
{% endmacro %} {# Small ? info icon with a click-triggered popover. Body can be arbitrary HTML (caller passes it as the macro body via {% call %}). #} {% macro info_tooltip(width="w-64") %}
{{ caller() }}
{% endmacro %} {# -- Buttons --------------------------------------------------------------- Two flavors share the same look (teal border, translucent teal fill, white text, hover deepens). The class string is computed once here so future tweaks (radius, hover ramp, disabled shade) propagate to both. #} {%- set _primary_button_classes -%} text-sm text-white border border-aegis-teal bg-aegis-teal/10 rounded px-4 py-2.5 hover:bg-aegis-teal/20 transition-colors disabled:opacity-50 disabled:cursor-not-allowed inline-flex items-center justify-center gap-2 {%- endset -%} {# Inline primary button (no loading spinner). Defaults to ``type="button"`` so it doesn't accidentally submit a form it's nested inside — pass ``type="submit"`` explicitly when you want submit semantics. ``attrs`` lets the caller pass arbitrary attributes (Alpine ``@click``, ``:disabled``, ``aria-*``) without bloating the macro signature. #} {% macro primary_button(label, type="button", attrs="") %} {% endmacro %} {# Primary submit button with an inline loading spinner. Parent scope must expose ``loading`` (bool) — typically flipped by ``@submit="loading = true"`` on the form. The button disables itself while loading so a double-click can't double-submit. #} {% macro submit_button(idle_label, loading_label) %} {% endmacro %} {# -- Form fields ----------------------------------------------------------- #} {# Themed combobox — replaces native {% endmacro %} {# "OR" divider with hairlines — sits between a form and an alternate action (e.g. email/password above, OAuth buttons below). #} {% macro or_divider() %}
or
{% endmacro %}